<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ include file="/WEB-INF/jsp/commons/includes.jsp" %>

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑文档|OneThink管理平台</title>
    <link href="${ctx}/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/module.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/style.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}/admin/css/default_color.css" media="all">
    <!--[if lt IE 9]>
    <script type="text/javascript" src="${ctx}/static/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="${ctx}/static/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="${ctx}/admin/js/jquery.mousewheel.js"></script>
    <!--<![endif]-->

</head>
<body>
<!-- 头部 -->
<div class="header">
    <!-- Logo -->
    <span class="logo"></span>
    <!-- /Logo -->

    <!-- 主导航 -->
    <ul class="main-nav">
    </ul>
    <!-- /主导航 -->

    <!-- 用户栏 -->
    <div class="user-bar">
        <a href="javascript:;" class="user-entrance"><i class="icon-user"></i></a>
        <ul class="nav-list user-menu hidden">
            <li class="manager">你好，<em title="Administrator">Administrator</em></li>
            <li><a href="/ot/admin.php?s=/User/updatePassword.html">修改密码</a></li>
            <li><a href="/ot/admin.php?s=/User/updateNickname.html">修改昵称</a></li>
            <li><a href="/ot/admin.php?s=/Public/logout.html">退出</a></li>
        </ul>
    </div>
</div>
<!-- /头部 -->

<!-- 边栏 -->
<%--<div class="sidebar">--%>
<%--</div>--%>
<%@ include file="/WEB-INF/jsp/commons/leftmenu.jsp" %>
<!-- /边栏 -->

<!-- 内容区 -->
<div id="main-content">
    <div id="top-alert" class="fixed alert alert-error" style="display: none;">
        <button class="close fixed" style="margin-top: 4px;">&times;</button>
        <div class="alert-content">这是内容</div>
    </div>
    <div id="main" class="main">

        <!-- nav -->
        <!-- nav -->
        <script type="text/javascript" src="${ctx}/static/uploadify/jquery.uploadify.min.js"></script>
        <div class="main-title cf">
            <h2>
                添加产品
            </h2>
        </div>


        <div class="cf">
            <div class="fl">
                <a class="btn" href="${ctx}/admin/product/add.shtml">新 增</a>
            </div>

            <form id="searchForm" action="${ctx}/admin/product/index.shtml" method="post">
                <%@ include file="/WEB-INF/jsp/commons/pageinfohidden.jsp" %>
                <!-- 高级搜索 -->
                <div class="search-form fr cf">
                    <div class="sleft">
                        <input type="text" name="sn" class="search-input" value="${queryvo.sn}" placeholder="请输入产品号"/>
                        <span> </span>
                        <input type="text" name="name" class="search-input" value="${queryvo.name}" placeholder="请输入产品名称"/>
                        <a class="sch-btn" href="javascript:;" id="search" url="${ctx}/admin/product/index.shtml"><i class="btn-search"></i></a>
                    </div>

                    <div class="btn-group-click adv-sch-pannel fl">
                        <button class="btn" onclick="return false;">高 级<i class="btn-arrowdown"></i></button>
                        <div class="dropdown cf" style="display: none;">
                            <div class="row">
                                <label>起止日期：</label>

                                <input type="text" id="timeStart" name="timeStart" class="text input-2x" value="<fmt:formatDate value="${queryvo.timeStart}" pattern="yyyy-MM-dd"/>" placeholder="起始时间"> -
                                <input type="text" id="timeEnd" name="timeEnd" class="text input-2x" value="<fmt:formatDate value="${queryvo.timeEnd}" pattern="yyyy-MM-dd"/>" placeholder="结束时间">
                                <span class="check-tips">（可选择的）</span>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>


        <!-- 数据列表 -->
        <div class="data-table table-striped">

            <table class="">
                <thead>
                <tr>
                    <th class="">产品号</th>
                    <th class="">产品名称</th>
                    <th class="">版本号</th>
                    <th class="">月价格</th>
                    <th class="">年价格</th>
                    <th class="">是否售卖</th>
                    <th class="">排序</th>
                    <th class="">操作</th>
                </tr>
                </thead>
                <tbody>
                    <c:forEach var="cur" items="${info}" varStatus="vs">
                        <tr>
                            <td>${cur.sn}</td>
                            <td>${cur.name}</td>
                            <td>${cur.ver}</td>
                            <td>${cur.mnPrice}</td>
                            <td>${cur.isYear}</td>
                            <td><c:if test="${cur.isSale==1}">是</c:if><c:if test="${cur.isSale==0}">否</c:if></td>
                            <td>${cur.sort}</td>
                            <td>
                                <a href="${ctx}/admin/product/edit/${cur.id}.shtml">编辑</a>
                                <a href="${ctx}/admin/product/delete/${cur.id}.shtml" class="ajax-get">下架</a>
                            </td>
                        </tr>
                    </c:forEach>
                </tbody>
            </table>
        </div>

        <%@ include file="/WEB-INF/jsp/commons/pageinfo.jsp" %>

    </div>
    <div class="cont-ft">
        <div class="copyright">
            <div class="fl">感谢使用管理平台</div>
            <div class="fr">V1.1.141101</div>
        </div>
    </div>
</div>
<!-- /内容区 -->

<script type="text/javascript" src="${ctx}/admin/js/common.js"></script>
<script type="text/javascript">
    +function(){
        var $window = $(window), $subnav = $("#subnav"), url;
        $window.resize(function(){
            $("#main").css("min-height", $window.height() - 130);
        }).resize();

        /* 左边菜单高亮 */
        url = window.location.pathname + window.location.search;
        url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
        $subnav.find("a[href='" + url + "']").parent().addClass("current");

        /* 左边菜单显示收起 */
        $("#subnav").on("click", "h3", function(){
            var $this = $(this);
            $this.find(".icon").toggleClass("icon-fold");
            $this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
            prev("h3").find("i").addClass("icon-fold").end().end().hide();
        });

        $("#subnav h3 a").click(function(e){e.stopPropagation()});

        /* 头部管理员菜单 */
        $(".user-bar").mouseenter(function(){
            var userMenu = $(this).children(".user-menu ");
            userMenu.removeClass("hidden");
            clearTimeout(userMenu.data("timeout"));
        }).mouseleave(function(){
            var userMenu = $(this).children(".user-menu");
            userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
            userMenu.data("timeout", setTimeout(function(){userMenu.addClass("hidden")}, 100));
        });

        /* 表单获取焦点变色 */
        $("form").on("focus", "input", function(){
            $(this).addClass('focus');
        }).on("blur","input",function(){
            $(this).removeClass('focus');
        });
        $("form").on("focus", "textarea", function(){
            $(this).closest('label').addClass('focus');
        }).on("blur","textarea",function(){
            $(this).closest('label').removeClass('focus');
        });

        // 导航栏超出窗口高度后的模拟滚动条
        var sHeight = $(".sidebar").height();
        var subHeight  = $(".subnav").height();
        var diff = subHeight - sHeight; //250
        var sub = $(".subnav");
        if(diff > 0){
            $(window).mousewheel(function(event, delta){
                if(delta>0){
                    if(parseInt(sub.css('marginTop'))>-10){
                        sub.css('marginTop','0px');
                    }else{
                        sub.css('marginTop','+='+10);
                    }
                }else{
                    if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                        sub.css('marginTop','-'+(diff-10));
                    }else{
                        sub.css('marginTop','-='+10);
                    }
                }
            });
        }
    }();
</script>

<link href="${ctx}/static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="${ctx}/static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="${ctx}/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="${ctx}/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        $(function(){
            $('.date').datetimepicker({
                format: 'yyyy-mm-dd',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });
            $('.time').datetimepicker({
                format: 'yyyy-mm-dd hh:ii',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });

            $('#timeStart').datetimepicker({
                format: 'yyyy-mm-dd',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });

            $('#timeEnd').datetimepicker({
                format: 'yyyy-mm-dd',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });

            $('#submit').click(function(){
                $('#form').submit();
            });

            //搜索功能
            $("#search").click(function(){
                $("#searchForm").submit();
            });
            //回车搜索
            $(".search-input").keyup(function(e){
                if(e.keyCode === 13){
                    $("#searchForm").submit();
                    return false;
                }
            });
            showTab();

//            $(".data-table form ")
        });
    </script>
</body>
</html>